<template>

  <data-table
    ref="pagingTable"
    :options="options"
    :list-query="listQuery"
  >
    <template #filter-content>

      <el-input v-model="listQuery.params.title" placeholder="搜索课程" style="width: 200px;" class="filter-item" />

    </template>

    <template #data-columns>

      <el-table-column
        label="用户"
        prop="userId_dictText"
      />

      <el-table-column
        label="课程"
        prop="title"
        align="courseId_dictText"
      />

      <el-table-column
        label="评论内容"
        prop="content"
        align="center"
      />

      <el-table-column
        label="创建时间"
        align="center"
        prop="createTime"
      />

      <el-table-column
        label="操作"
        align="center"
      >

        <template v-slot="scope">
          <el-button size="small" type="default" icon="el-icon-edit" @click="toUpdate(scope.row.id)">修改</el-button>
        </template>

      </el-table-column>

    </template>

  </data-table>

</template>

<script>
import DataTable from '@/components/DataTable'

export default {
  name: 'QuList',
  components: { DataTable },
  data() {
    return {

      listQuery: {
        current: 1,
        size: 10,
        params: {
          title: ''
        }
      },

      options: {

        // 可批量操作
        multi: true,

        // 批量操作列表
        multiActions: [
          {
            value: 'delete',
            label: '删除'
          }
        ],
        // 列表请求URL
        listUrl: '/api/course/comment/paging',
        // 删除请求URL
        deleteUrl: '/api/course/comment/delete',
        // 添加数据路由
        addRoute: 'AddCourse'
      }
    }
  },
  methods: {

    fileList(courseId) {
      this.$router.push({ name: 'ListCourseFile', params: { courseId: courseId }})
    },

    toUpdate(courseId) {
      this.$router.push({ name: 'UpdateCourse', params: { id: courseId }})
    }
  }
}
</script>
